<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>层次定位</title>
    <style>
        div{
            height: 100px;
            width: 100px;
            position: absolute;
            top: 0px;
            left: 0px;
            background-color: yellow;
            z-index: 3;
        }
        #two{
            top: 20px;
            left: 20px;
            background-color: grey;
            z-index: 2;
        }
        #three{
            top: 40px;
            left: 40px;
            background-color: pink;
            z-index: 1;
        }
    </style>
</head>
<body>
    <div id="one">1</div>
    <div id="two">2</div>
    <div id="three">3</div>
</body>
</html>